package com.ss.android.common.dialog;

import android.view.View;
import android.view.ViewTreeObserver;
import java.lang.ref.WeakReference;

final class k implements ViewTreeObserver.OnGlobalLayoutListener {
    private final WindowBuilder a;

    k(WindowBuilder arg1) {
        this.a = arg1;

    }

    public final void onGlobalLayout() {
        WeakReference v2 = null;
        Object v0 = this.a.r.get();
        if(v0 != null) {
            this.a.r.clear();
            this.a.r = v2;
            ((View)v0).getViewTreeObserver().removeGlobalOnLayoutListener(((ViewTreeObserver.OnGlobalLayoutListener)this));
            if(this.a.o == null) {
                this.a.o = ((View)v0).getWindowToken();
            }

            if(this.a.o == null) {
                return;
            }

            if(this.a.s == null) {
                return;
            }

            if(!this.a.p.d) {
                this.a.s.run();
            }

            this.a.s = ((Runnable)v2);
        }
    }
}

